home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 24 / Amiga Format AFCD24 (Feb 1998, Issue 108).iso / -in_the_mag- / emulation / amiga / uae-0.7.0b2 / configure.in < prev    next >
Text File  |  1998-01-20  |  32KB  |  1,102 lines

  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl Written 1996, 1997 Bernd Schmidt
  3.  
  4. dnl If you can use anything from this file, feel free to steal it. I put
  5. dnl this into the public domain.
  6.  
  7. dnl There are still many uncaught errors (e.g. --enable-dga on an Amiga)
  8. dnl I didn't have the nerve to track them all down.
  9.  
  10. AC_INIT(amiga/source/transdisk.c)
  11. AC_PREREQ(2.12)
  12. dnl Checks for programs.
  13. AC_PROG_CC
  14.  
  15. AC_PROG_CPP
  16. AC_PROG_MAKE_SET
  17. AC_CHECK_PROG(HAVE_WISH40,wish4.0,yes,no)
  18. AC_PATH_PROG(FILEPRG, file, not-found)
  19.  
  20. AC_AIX
  21. AC_ISC_POSIX
  22.  
  23. NR_WARNINGS=0
  24. NR_ERRORS=0
  25.  
  26. NEED_THREAD_SUPPORT=no
  27.  
  28. ADDITIONAL_CFLAGS=
  29. OPTIMIZE_CFLAGS=
  30. WARNING_CFLAGS=
  31. DEBUG_CFLAGS=
  32. NO_SCHED_CFLAGS=
  33.  
  34. dnl Checks for libraries.
  35. HAVE_BEOS=no
  36. HAVE_POS=no
  37. dnl Replace `main' with a function in -lMedia_s: (Ian!)
  38. AC_CHECK_LIB(Media_s, main, HAVE_MEDIA_LIB=yes, HAVE_MEDIA_LIB=no)
  39. dnl Replace `main' with a function in -lNeXT_s:
  40. AC_CHECK_LIB(NeXT_s, main, HAVE_NEXT_LIB=yes, HAVE_NEXT_LIB=no)
  41. AC_CHECK_LIB(amiga, OpenLibrary, HAVE_AMIGA_LIB=yes, HAVE_AMIGA_LIB=n)
  42. AC_CHECK_LIB(vga, vga_setmode, HAVE_SVGA_LIB=yes, HAVE_SVGA_LIB=no)
  43. AC_CHECK_LIB(AF, AFOpenAudioConn, HAVE_AF_LIB=yes, HAVE_AF_LIB=no)
  44. AC_CHECK_LIB(ncurses, waddch, HAVE_NCURSES_LIB=yes, HAVE_NCURSES_LIB=no)
  45. AC_CHECK_LIB(pthread, pthread_create, HAVE_PTHREAD_LIB=yes, HAVE_PTHREAD_LIB=no)
  46. AC_CHECK_LIB(posix4, sem_init, HAVE_POSIX4_LIB=yes, HAVE_POSIX4_LIB=no)
  47. AC_CHECK_LIB(ggi, ggiInit, HAVE_GGI_LIB=yes, HAVE_GGI_LIB=no)
  48.  
  49. dnl Check for pOS or -target=p.os
  50. if [[ $target = "p.os" ]]; then
  51.     HAVE_POS=yes
  52. else
  53. dnl Check for pOS
  54.  
  55. cat >conftest.c << EOF
  56. int main()
  57. {
  58. #ifdef __POS__
  59. printf("POS\n");
  60. #endif
  61. return 0;
  62. }
  63. EOF
  64. $CC $CFLAGS conftest.c -c -o conftest.o
  65. $CC conftest.o -o conftest
  66. ./conftest >conftest.file
  67. if grep POS conftest.file >/dev/null; then
  68.   HAVE_POS=yes
  69. else
  70.   HAVE_POS=no
  71. fi
  72. rm -f conftest*
  73. fi
  74.  
  75. AC_PATH_XTRA
  76. AC_CONFIG_HEADER(src/include/sysconfig.h)
  77.  
  78. AC_HEADER_DIRENT
  79. AC_HEADER_STDC
  80.  
  81. dnl @@@ Is <sys/termios.h> the right way or is it <termios.h>?
  82. AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/types.h utime.h string.h strings.h values.h ncurses.h curses.h)
  83. AC_CHECK_HEADERS(sys/vfs.h sys/mount.h sys/select.h sys/param.h sys/statfs.h sys/statvfs.h sys/stat.h linux/joystick.h)
  84. AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h sun/audioio.h sys/audioio.h getopt.h features.h sys/termios.h)
  85. AC_CHECK_HEADERS(posix_opt.h sys/ioctl.h sys/ipc.h sys/shm.h)
  86. AC_CHECK_HEADERS(ggi/libggi.h gtk/gtk.h X11/forms.h forms.h)
  87. AC_CHECK_HEADER(be/Be.h, HAVE_BEOS=yes, HAVE_BEOS=no)
  88.  
  89. AC_CHECK_SIZEOF(char, 1)
  90. AC_CHECK_SIZEOF(short, 2)
  91. AC_CHECK_SIZEOF(int, 4)
  92. AC_CHECK_SIZEOF(long, 4)
  93. AC_CHECK_SIZEOF(long long, 8)
  94.  
  95. dnl Checks for typedefs, structures, and compiler characteristics.
  96. AC_C_CONST
  97. AC_C_INLINE
  98. if [[ "x$ac_cv_c_inline" = "xno" ]]; then
  99.   ac_cv_c_inline=
  100. fi
  101. AC_TYPE_MODE_T
  102. AC_TYPE_OFF_T
  103. AC_TYPE_PID_T
  104. AC_STRUCT_ST_BLOCKS
  105. AC_HEADER_TIME
  106. AC_STRUCT_TM
  107.  
  108. dnl Checks for library functions.
  109. AC_PROG_GCC_TRADITIONAL
  110. AC_FUNC_MEMCMP
  111. AC_TYPE_SIGNAL
  112. AC_FUNC_UTIME_NULL
  113. AC_CHECK_FUNCS(getcwd getopt strdup gettimeofday sigaction mkdir rmdir select strerror strstr statfs)
  114. AC_CHECK_FUNCS(tcgetattr cfmakeraw readdir_r)
  115.  
  116. AC_MSG_CHECKING(how many args statfs takes)
  117. if [[ "x$ac_cv_func_statfs" = "xyes" ]]; then
  118.   AC_TRY_COMPILE([
  119. #include "confdefs.h"
  120. #ifdef HAVE_SYS_TYPES_H
  121. #include <sys/types.h>
  122. #endif
  123. #ifdef HAVE_SYS_PARAM_H
  124. #include <sys/param.h>
  125. #endif
  126. #ifdef HAVE_SYS_MOUNT_H
  127. #include <sys/mount.h>
  128. #endif
  129. #ifdef HAVE_SYS_SELECT_H
  130. #include <sys/select.h>
  131. #endif
  132. #ifdef HAVE_SYS_VFS_H
  133. #include <sys/vfs.h>
  134. #endif
  135. #ifdef HAVE_SYS_STATFS_H
  136. #include <sys/statfs.h>
  137. #endif
  138. #ifdef HAVE_SYS_STATVFS_H
  139. #include <sys/statvfs.h>
  140. #endif],[struct statfs statbuf;statfs("/",&statbuf);],
  141. AC_MSG_RESULT(2) 
  142. STATFS_NO_ARGS=2,
  143. AC_MSG_RESULT(4)
  144. STATFS_NO_ARGS=4)
  145. fi
  146.  
  147. AC_MSG_CHECKING(whether to use f_bavail or f_bfree)
  148. if [[ "x$ac_cv_func_statfs" = "xyes" ]]; then
  149.   AC_TRY_COMPILE([
  150. #include "confdefs.h"
  151. #ifdef HAVE_SYS_TYPES_H
  152. #include <sys/types.h>
  153. #endif
  154. #ifdef HAVE_SYS_PARAM_H
  155. #include <sys/param.h>
  156. #endif
  157. #ifdef HAVE_SYS_MOUNT_H
  158. #include <sys/mount.h>
  159. #endif
  160. #ifdef HAVE_SYS_SELECT_H
  161. #include <sys/select.h>
  162. #endif
  163. #ifdef HAVE_SYS_VFS_H
  164. #include <sys/vfs.h>
  165. #endif
  166. #ifdef HAVE_SYS_STATFS_H
  167. #include <sys/statfs.h>
  168. #endif
  169. #ifdef HAVE_SYS_STATVFS_H
  170. #include <sys/statvfs.h>
  171. #endif],[struct statfs statbuf;statbuf.f_bavail;],
  172. AC_MSG_RESULT(f_bavail) 
  173. STATBUF_BAVAIL=f_bavail,
  174. AC_MSG_RESULT(f_bfree)
  175. STATBUF_BAVAIL=f_bfree)
  176. fi
  177.  
  178. if [[ "x$ac_cv_header_linux_joystick_h" = "xyes" ]]; then
  179.   AC_MSG_CHECKING(whether linux/joystick.h is broken)
  180.   if grep "#include" /usr/include/linux/joystick.h >/dev/null; then
  181.     AC_MSG_RESULT(yes)
  182.     BROKEN_JOYSTICK_H=1
  183.     grep -v "#include" /usr/include/linux/joystick.h >src/include/ljoystick.h
  184.   else
  185.     AC_MSG_RESULT(no)
  186.     BROKEN_JOYSTICK_H=0
  187.   fi
  188.   dnl Alan Cox or someone else kindly changed all the types when integrating
  189.   dnl the joystick driver into the kernel so we have to add some more
  190.   dnl conditionals...
  191.   AC_MSG_CHECKING(what types linux/joystick.h defines)
  192.   if grep "JS_DATA_TYPE" /usr/include/linux/joystick.h >/dev/null; then
  193.     AC_MSG_RESULT(the old ones)
  194.     OLD_JOYSTICK_H=1
  195.   else
  196.     AC_MSG_RESULT(the new ones)
  197.     OLD_JOYSTICK_H=0
  198.   fi
  199. fi
  200.  
  201. dnl Verify that the ncurses installation makes some sense.
  202.  
  203. if [[ "x$HAVE_NCURSES_LIB" = "xyes" ]]; then
  204.   if [[ "x$ac_cv_header_ncurses_h" = "xno" -a "x$ac_cv_header_curses_h" = "xno" ]]; then
  205.     echo "Installation problem, found libncurses but neither curses.h nor ncurses.h!"
  206.     HAVE_NCURSES_LIB=no
  207.     NR_ERRORS=`expr $NR_ERRORS + 1`
  208.   else
  209.     if [[ "x$ac_cv_header_ncurses_h" = "xno" ]]; then
  210.       AC_MSG_CHECKING(for attr_t in curses.h)
  211.       AC_TRY_COMPILE([#include <curses.h>],[{ attr_t a; a = A_NORMAL; }], AC_MSG_RESULT(yes),
  212.       [
  213.         ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DDONT_HAVE_ATTR_T"
  214.         AC_MSG_RESULT(no)
  215.     NR_WARNINGS=`expr $NR_WARNINGS + 1`
  216.     echo "Please install a newer version of libncurses if you can."
  217.       ])
  218.     else
  219.       AC_MSG_CHECKING(for attr_t in ncurses.h)
  220.       AC_TRY_COMPILE([#include <ncurses.h>],[{ attr_t a; a = A_NORMAL; }], AC_MSG_RESULT(yes),
  221.       [
  222.         ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DDONT_HAVE_ATTR_T"
  223.         AC_MSG_RESULT(no)
  224.     NR_WARNINGS=`expr $NR_WARNINGS + 1`
  225.     echo "Please install a newer version of libncurses if you can."
  226.       ])
  227.     fi
  228.   fi
  229. fi
  230.  
  231. DO_PROFILING=no
  232. WANT_GGI=dunno
  233. WANT_SVGALIB=dunno
  234. WANT_ASCIIART=dunno
  235. WANT_UI=dunno
  236. WANT_TKGUI=no
  237. WANT_XFGUI=no
  238. WANT_NCURSES_UI=no
  239. WANT_DGA=no
  240. WANT_VIDMODE=no
  241. SYSTEM_IS_ELF=dunno
  242.  
  243. AC_ARG_ENABLE(profiling,[  --enable-profiling      Build a profiling (SLOW!) version],[DO_PROFILING=$enableval],[])
  244. AC_ARG_WITH(svgalib,[  --with-svgalib          Use SVGAlib for graphics output],[WANT_SVGALIB=$withval],[])
  245. AC_ARG_WITH(ggi,[  --with-ggi              Use GGI for graphics output],[WANT_GGI=$withval],[])
  246. AC_ARG_WITH(asciiart,[  --with-asciiart         Use ncurses ascii art for graphics output],[WANT_ASCIIART=$withval],[])
  247. AC_ARG_ENABLE(dga,[  --enable-dga            X11 version: Use the DGA extension],[WANT_DGA=$enableval],[])
  248. AC_ARG_ENABLE(vidmode,[  --enable-vidmode        X11 version: Use the XF86VidMode extension],[WANT_VIDMODE=$enableval],[])
  249. AC_ARG_ENABLE(ui,[  --enable-ui             Use a user interface if possible (default on)],[WANT_UI=$enableval],[])
  250. AC_ARG_ENABLE(xfgui,[  --enable-xfgui          X11 version: Use XForms GUI instead of the gtk+ one],[WANT_XFGUI=$enableval],[])
  251. AC_ARG_ENABLE(tkgui,[  --enable-tkgui          X11 version: Use Tk GUI instead of the gtk+ one],[WANT_TKGUI=$enableval],[])
  252. AC_ARG_WITH(elf,[  --with-elf              Explicitly state that this system is ELF],[SYSTEM_IS_ELF=$withval],[])
  253.  
  254. dnl Some simple plausibility tests...
  255.  
  256. if [[ "x$WANT_DGA" = "xyes" ]]; then
  257.   if [[ "x$WANT_SVGALIB" = "xyes" -o "x$WANT_GGI" = "xyes" -o "x$WANT_ASCIIART" = "xyes" ]]; then
  258.     echo "You can't enable DGA for SVGAlib, GGI and ncurses targets!"
  259.     NR_ERRORS=`expr $NR_ERRORS + 1`
  260.     WANT_DGA=no
  261.   fi
  262. fi
  263.  
  264. if [[ "x$WANT_DGA" = "xyes" -a "x$no_x" = "xyes" ]]; then
  265.   echo "Ignoring --enable-dga, since X was disabled or not found."
  266.   NR_ERRORS=`expr $NR_ERRORS + 1`
  267.   WANT_DGA=no
  268. fi
  269.  
  270. if [[ "x$WANT_DGA" = "xno" -a "x$WANT_VIDMODE" = "xyes" ]]; then
  271.   echo "The XF86VidMode extension can only be used in DGA mode. Disabling it."
  272.   NR_ERRORS=`expr $NR_ERRORS + 1`
  273.   WANT_VIDMODE=no
  274. fi
  275.  
  276. dnl Make sure WANT_UI is set if WANT_XFGUI is set.
  277.  
  278. if [[ "x$WANT_UI" = "xno" ]]; then
  279.   if [[ "x$WANT_XFGUI" = "xyes" -o "x$WANT_TKGUI" = "xyes" ]]; then
  280.     echo "You can't specify --disable-ui with --enable-xfgui or --enable-tkgui."
  281.     echo "Disabling GUI."
  282.     NR_ERRORS=`expr $NR_ERRORS + 1`
  283.     WANT_XFGUI=no
  284.   fi
  285. fi
  286.  
  287. dnl Check if we have the libraries needed for the user's selection.
  288.  
  289. if [[ "x$WANT_SVGALIB" = "xyes" ]]; then
  290.   if [[ "x$HAVE_SVGA_LIB" = "xno" ]]; then
  291.     echo "Could not find libsvga, disabling svgalib support."
  292.     NR_ERRORS=`expr $NR_ERRORS + 1`
  293.     WANT_GGI=no
  294.   else
  295.     no_x=yes
  296.   fi
  297. fi
  298.  
  299. if [[ "x$WANT_GGI" = "xyes" ]]; then
  300.   if [[ "x$HAVE_GGI_LIB" = "xno" ]]; then
  301.     echo "Could not find libggi, disabling GGI support."
  302.     NR_ERRORS=`expr $NR_ERRORS + 1`
  303.     WANT_GGI=no
  304.   else if [[ "x$WANT_SVGALIB" = "xyes" ]]; then
  305.     echo "You can't configure for both SVGAlib and GGI. Disabling GGI."
  306.     NR_ERRORS=`expr $NR_ERRORS + 1`
  307.     WANT_GGI=no
  308.   else
  309.     no_x=yes
  310.   fi
  311.   fi
  312. fi
  313.  
  314. if [[ "x$WANT_ASCIIART" = "xyes" ]]; then
  315.   if [[ "x$HAVE_NCURSES_LIB" = "xno" ]]; then
  316.     echo "Could not find libncurses, disabling ascii art support."
  317.     NR_ERRORS=`expr $NR_ERRORS + 1`
  318.     WANT_ASCIIART=no
  319.   else if [[ "x$WANT_SVGALIB" = "xyes" -o "x$WANT_GGI" = "xyes" ]]; then
  320.     echo "You can't configure for both ncurses and another target. Disabling ncurses."
  321.     NR_ERRORS=`expr $NR_ERRORS + 1`
  322.     WANT_ASCIIART=no
  323.   else
  324.     no_x=yes
  325.   fi
  326.   fi
  327. fi
  328.  
  329. dnl If the user wants DGA, see if we have it.
  330. dnl This must come after we checked for X11.
  331.  
  332. if [[ "x$WANT_DGA" = "xyes" ]]; then
  333.   TMP_SAVE_LIBS=$LIBS
  334.   LIBS="$X_LIBS $LIBS"
  335.   AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, HAVE_DGA=yes, HAVE_DGA=no, [ $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS ])
  336.   LIBS=$TMP_SAVE_LIBS
  337.   if [[ "x$HAVE_DGA" = "xno" ]]; then
  338.     echo "Could not find DGA extension, ignoring --enable-dga."
  339.     NR_ERRORS=`expr $NR_ERRORS + 1`
  340.     WANT_DGA=no
  341.   fi
  342. fi
  343.  
  344. if [[ "x$WANT_VIDMODE" = "xyes" ]]; then
  345.   TMP_SAVE_LIBS=$LIBS
  346.   LIBS="$X_LIBS $LIBS"
  347.   AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, HAVE_VIDMODE=yes, HAVE_VIDMODE=no, [ $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS ])
  348.   LIBS=$TMP_SAVE_LIBS
  349.   if [[ "x$HAVE_VIDMODE" = "xno" ]]; then
  350.     echo "Could not find VidMode extension, ignoring --enable-vidmode."
  351.     NR_ERRORS=`expr $NR_ERRORS + 1`
  352.     WANT_VIDMODE=no
  353.   fi
  354. fi
  355.  
  356. dnl Check for X Forms library. Boy is this complicated
  357. dnl Also check for gtk/gdk/glib.
  358. dnl This must also come after the X11 check.
  359. if [[ "x$no_x" = "xyes" ]]; then
  360.   HAVE_XFORMS=no
  361.   HAVE_GTK=no
  362. else
  363.   if [[ "x$ac_cv_header_forms_h" != "xyes" -a "x$ac_cv_header_X11_forms_h" != "xyes" ]]; then
  364.     HAVE_XFORMS=no
  365.   else
  366.     TMP_SAVE_LIBS=$LIBS
  367.     LIBS="$X_LIBS $LIBS -lforms $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm"
  368.     AC_CHECK_LIB(forms, fl_library_version, HAVE_XFORMS=yes, HAVE_XFORMS=no)
  369.     LIBS=$TMP_SAVE_LIBS
  370.     if [[ "x$ac_cv_header_forms_h" = "xyes" ]]; then
  371.       FORMS_HEADER=forms.h
  372.     else
  373.       FORMS_HEADER=X11/forms.h
  374.     fi
  375.   fi
  376.   if [[ "x$ac_cv_header_gtk_gtk_h" != "xyes" -o "x$HAVE_PTHREAD_LIB" != "xyes" ]]; then
  377.     HAVE_GTK=no
  378.   else
  379.     TMP_SAVE_LIBS=$LIBS
  380.     dnl The gtk+ UI needs thread support.
  381.     LIBS="$X_LIBS $LIBS -lgtk -lgdk -lglib $X_PRE_LIBS -lX11 -lXext $X_EXTRA_LIBS -lm -pthread"
  382.     if [[ "x$HAVE_POSIX4_LIB" = "xyes" ]]; then
  383.       LIBS="$LIBS -lposix4"
  384.     fi
  385.     AC_CHECK_LIB(gtk, gtk_main, HAVE_GTK=yes, HAVE_GTK=no)
  386.     LIBS=$TMP_SAVE_LIBS    
  387.   fi
  388. fi
  389.  
  390. if [[ "x$HAVE_XFORMS" = "xyes" ]]; then
  391.   echo '#include "'$FORMS_HEADER\" >conftest.c
  392.   cat >>conftest.c << EOF
  393. int main()
  394. {
  395.   if (fl_library_version(NULL, NULL) == FL_INCLUDE_VERSION
  396.       && FL_INCLUDE_VERSION >= 80)
  397.       printf("OK\n");
  398. return 0;
  399. }
  400. EOF
  401.   $CC conftest.c -c -o conftest.o  $CFLAGS
  402.   $CC conftest.o -o conftest $X_LIBS $LIBS -lforms $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm
  403.   ./conftest >conftest.file
  404.   if grep OK conftest.file >/dev/null; then
  405.     echo "X Forms include and library version match."
  406.   else
  407.     echo "Installation problem with the X Forms library, versions don't match!"
  408.     NR_ERRORS=`expr $NR_ERRORS + 1`
  409.     HAVE_XFORMS=no
  410.   fi
  411. fi
  412.  
  413. dnl If --enable-ui --enable-dga is given, give UI priority.
  414. if [[ "x$WANT_UI" = "xyes" -a "x$WANT_DGA" = "xyes" ]]; then
  415.   echo "Can't use a GUI with DGA - disabling DGA."
  416.   NR_ERRORS=`expr $NR_ERRORS + 1`
  417.   WAMT_DGA=no
  418.   WANT_VIDMODE=no
  419. fi
  420.  
  421. dnl Without explicit --enable-ui, silently turn off the UI if DGA is wanted.
  422. if [[ "x$WANT_DGA" = "xyes" ]]; then
  423.   WANT_UI=no
  424.   WANT_XFGUI=no
  425.   WANT_TKGUI=no
  426. fi
  427.  
  428. dnl The GUIs need stuff...
  429. if [[ "x$WANT_XFGUI" = "xyes" ]]; then
  430.   if [[ "x$WANT_TKGUI" = "yes" ]]; then
  431.     echo "You can't have both the X Forms GUI and the Tk GUI!"
  432.     NR_ERRORS=`expr $NR_ERRORS + 1`
  433.     WANT_TKGUI=no    
  434.   fi
  435.   if [[ "x$HAVE_XFORMS" = "xno" ]]; then
  436.     echo "Can't use the X Forms library; X Forms GUI disabled."
  437.     NR_ERRORS=`expr $NR_ERRORS + 1`
  438.     WANT_XFGUI=no
  439.   fi
  440. fi
  441.  
  442. if [[ "x$HAVE_TKGUI" = "xyes" ]]; then
  443.   if [[ "x$HAVE_WISH40" != "xyes" ]]; then
  444.     echo "Can't find wish4.0; Tk GUI disabled."
  445.     NR_ERRORS=`expr $NR_ERRORS + 1`
  446.     WANT_TKGUI=no
  447.   fi
  448. fi
  449.  
  450. dnl See if we can at least compile SHM support
  451.  
  452. SHM_SUPPORT_LINKS=0
  453. if [[ "x$no_x" != "xyes" -a "x$WANT_DGA" != "xyes" -a "x$ac_cv_header_sys_ipc_h" = "xyes" -a "x$ac_cv_header_sys_shm_h" = "xyes" ]]; then
  454.   AC_MSG_CHECKING(whether the X11 MIT-SHM extension can be compiled in)
  455.   TMP_SAVE_CFLAGS=$CFLAGS
  456.   TMP_SAVE_LIBS=$LIBS
  457.   CFLAGS="$CFLAGS $X_CFLAGS"
  458.   LIBS="$X_LIBS $LIBS $X_PRE_LIBS -lX11 -lXext $X_EXTRA_LIBS"
  459.   AC_TRY_LINK([
  460. #include "confdefs.h"
  461. #ifdef HAVE_SYS_TYPES_H
  462. #include <sys/types.h>
  463. #endif
  464. #include <X11/Xlib.h>
  465. #include <X11/Xutil.h>
  466. #include <X11/keysym.h>
  467. #include <X11/cursorfont.h>
  468. #include <sys/ipc.h>
  469. #include <sys/shm.h>
  470. #include <X11/extensions/XShm.h>],[
  471. static XShmSegmentInfo shminfo;
  472. static Display *display;
  473. void foo(void)
  474. {
  475. XShmAttach(display, &shminfo);
  476. XSync(display,0);
  477. shmctl(shminfo.shmid, IPC_RMID, 0);
  478. }],
  479. SHM_SUPPORT_LINKS=1
  480. AC_MSG_RESULT(yes),
  481. SHM_SUPPORT_LINKS=0
  482. AC_MSG_RESULT(no))
  483.   CFLAGS=$TMP_SAVE_CFLAGS
  484.   LIBS=$TMP_SAVE_LIBS
  485. fi
  486.  
  487. MATHLIB=-lm
  488. DEBUGOBJS="debug.o"
  489.  
  490. AC_MSG_CHECKING(which target to use)
  491.  
  492. if [[ "x$HAVE_BEOS" = "xyes" ]]; then
  493.   AC_MSG_RESULT(BeOS)
  494.   MATHLIB=
  495.   TARGET=beos
  496.   TARGETDEP=t-beos.h
  497.   GFXOBJS=osdep/beos.o
  498.   GUIOBJS=nogui.o
  499.   ac_cv_c_inline=
  500. else if [[ "x$HAVE_POS" = "xyes" ]]; then
  501.   AC_MSG_RESULT(p.OS)
  502.   TARGET=p_os
  503.   TARGETDEP=t-pos.h
  504.   GFXOBJS="osdep/pos-win.o osdep/pos-disk.o osdep/pos-rexx.o"
  505.   GUIOBJS="osdep/pos-gui.o"
  506. else if [[ "x$HAVE_AMIGA_LIB" = "xyes" ]]; then
  507.   AC_MSG_RESULT(AmigaOS)
  508.   TARGET=amigaos
  509.   TARGETDEP=t-amiga.h
  510.   GFXOBJS="osdep/ami-win.o osdep/ami-disk.o osdep/ami-rexx.o osdep/ami-appw.o"
  511.   GUIOBJS="osdep/ami-gui.o"
  512. else if [[ "x$HAVE_NEXT_LIB" = "xyes" ]]; then
  513.   AC_MSG_RESULT(NeXTStep)
  514.   MATHLIB=
  515.   TARGET=next
  516.   GFXOBJS="NeXTwin.o"
  517.   GUIOBJS=
  518.   TARGETDEP=t-next.h
  519.   LIBRARIES="-sectcreate __ICON __header ../Uae.app/Uae.iconheader -segprot __ICON r r -sectcreate __ICON app ../Uae.app/Uae.tiff -lMedia_s -lNeXT_s"
  520. else
  521.   dnl Unix system
  522.   dnl If we don't have X, see what else we have and/or want.
  523.  
  524.   if [[ "x$no_x" = "xyes" ]]; then
  525.     if [[ "x$WANT_SVGALIB" != "xyes" -a "x$WANT_GGI" != "xyes" -a "x$WANT_ASCIIART" != "xyes" ]]; then
  526.       if [[ "x$WANT_SVGALIB" != "xno" -a "x$HAVE_SVGA_LIB" = "xyes" ]]; then
  527.         WANT_SVGALIB=yes
  528.       else if [[ "x$WANT_GGI" != "xno" -a "x$HAVE_GGI_LIB" = "xyes" ]]; then
  529.         WANT_GGI=yes
  530.       else if [[ "x$WANT_ASCIIART" != "xno" -a "x$HAVE_NCURSES_LIB" = "xyes" ]]; then
  531.         WANT_ASCIIART=yes
  532.       fi
  533.       fi
  534.       fi
  535.     fi
  536.   fi
  537.  
  538.   if [[ "x$WANT_GGI" = "xyes" ]]; then
  539.     AC_MSG_RESULT(GGI)
  540.     TARGET=ggilib
  541.     TARGETDEP=t-ggi.h
  542.     WANT_NCURSES_UI=yes
  543.     GFXOBJS=ggi.o
  544.     LIBRARIES="-ldl -lggi"
  545.     LDFLAGS="-rdynamic $LDFLAGS"
  546.   else if [[ "x$WANT_SVGALIB" = "xyes" ]]; then
  547.     AC_MSG_RESULT(SVGAlib)
  548.     TARGET=svgalib
  549.     TARGETDEP=t-svgalib.h
  550.     GFXOBJS=svga.o
  551.     LIBRARIES="-lvga"
  552.     WANT_NCURSES_UI=yes
  553.   else if [[ "x$WANT_ASCIIART" = "xyes" ]]; then
  554.     AC_MSG_RESULT(ncurses ASCII art)
  555.     TARGET=asciiart
  556.     TARGETDEP=t-ascii.h
  557.     GFXOBJS="ncurses.o"
  558.     GUIOBJS="tui.o svgancui.o"
  559.     LIBRARIES="-lncurses"
  560.   else if [[ "x$no_x" = "xyes" ]]; then
  561.     AC_MSG_RESULT(Ummm....)
  562.     echo "Fatal error: No graphics system found, don't know what target to use."
  563.     exit 1
  564.   else
  565.     AC_MSG_RESULT(X11)
  566.     TARGET=x11
  567.     TARGETDEP=t-x11.h
  568.     GFXOBJS=xwin.o
  569.     GUIOBJS=nogui.o
  570.  
  571.     LIBRARIES="$X_LIBS $X_PRE_LIBS"
  572.     dnl If we still think we want DGA, set it up.
  573.     if [[ "x$WANT_DGA" = "xyes" ]]; then
  574.       LIBRARIES="$LIBRARIES -lXxf86dga"
  575.       X_CFLAGS="$X_CFLAGS -DUSE_DGA_EXTENSION"
  576.       if [[ "x$WANT_VIDMODE" = "xyes" ]]; then
  577.         LIBRARIES="$LIBRARIES -lXxf86vm"
  578.     X_CFLAGS="$X_CFLAGS -DUSE_VIDMODE_EXTENSION"
  579.       fi
  580.     fi
  581.     LIBRARIES="$LIBRARIES -lXext -lX11 $X_EXTRA_LIBS"
  582.  
  583.     if [[ "x$WANT_UI" != "xno" ]]; then
  584.       if [[ "x$WANT_XFGUI" = "xyes" ]]; then
  585.         echo "Using XForms GUI."
  586.     LIBRARIES="$LIBRARIES -lforms"
  587.     ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DUSING_FORMS_GUI"
  588.     GUIOBJS=
  589.     DEBUGOBJS=xdebug.o
  590.       else if [[ "x$WANT_TKGUI" = "xyes" ]]; then
  591.         echo "Using Tcl/Tk GUI."
  592.         ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DUSING_TCL_GUI"
  593.         GUIOBJS=xui.o
  594.       else
  595.         if [[ "x$HAVE_GTK" != "xyes" ]]; then
  596.       echo "Did not find gtk+, disabling user interface"
  597.       if [[ "x$WANT_UI" = "xyes" ]]; then
  598.         NR_ERRORS=`expr $NR_ERRORS + 1`
  599.       fi
  600.         else
  601.           echo "Using gtk+ GUI."
  602.       LIBRARIES="$LIBRARIES -lgtk -lgdk -lglib"
  603.       NEED_THREAD_SUPPORT=yes
  604.           ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DUSING_GTK_GUI"
  605.           GUIOBJS=gtkui.o
  606.     fi
  607.       fi
  608.       fi
  609.     fi
  610.   fi
  611.   fi
  612.   fi
  613.   fi
  614. fi
  615. fi
  616. fi
  617. fi
  618.  
  619. if [[ "x$WANT_NCURSES_UI" = "xyes" ]]; then
  620.   if [[ "x$HAVE_NCURSES_LIB" = "xno" ]]; then
  621.     if [[ "x$WANT_UI" = "xyes" ]]; then
  622.       echo "ncurses is unavailable, can't provide a user interface"
  623.       NR_ERRORS=`expr $NR_ERRORS + 1`      
  624.     fi
  625.     WANT_UI=no
  626.   fi
  627.   if [[ "x$WANT_UI" != "xno" ]]; then
  628.     GUIOBJS="tui.o svgancui.o"
  629.     LIBRARIES="$LIBRARIES -lncurses"
  630.     ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DUSING_CURSES_UI"
  631.     if [[ "x$ac_cv_header_ncurses_h" = "xno" ]]; then
  632.       echo "Found libncurses, but no ncurses.h. This is normal with recent versions"
  633.       echo "of ncurses, but it might indicate a problem with older versions."
  634.       NR_WARNINGS=`expr $NR_WARNINGS + 1`
  635.     fi
  636.   else
  637.     GUIOBJS=nogui.o
  638.   fi
  639. fi
  640.  
  641. GFXOBJS="$GFXOBJS $GUIOBJS"
  642.  
  643. dnl Find out some things about the system 
  644. dnl  - whether we have GCC 2.7 or better.
  645. dnl  - what CPU we have (to use some assembly hacks on the x86)
  646. dnl  - whether we are on a Linux system
  647. dnl  - whether that is an ELF system
  648. dnl  - whether it's running glibc-2.0
  649.  
  650. MACHDEP=md-generic
  651. OSDEP=od-generic
  652. THREADDEP=td-none
  653. SOUNDDEP=od-generic
  654.  
  655. USE_PENGUINS=no
  656. USE_THREADS=no
  657. USE_SOUND=no
  658. USE_FILE_SOUND=no
  659.  
  660. HAVEELF=no
  661. HAVELINUX=no
  662. HAVEGCC27=no
  663. HAVEI386=no
  664. HAVE68K=no
  665. HAVEGLIBC2=no
  666.  
  667. ASMOBJS=
  668. CPUOBJS="cpu0.o cpu1.o cpu2.o cpu3.o cpu4.o cpu5.o cpu6.o cpu7.o cpu8.o cpu9.o cpuA.o cpuB.o cpuC.o cpuD.o cpuE.o cpuF.o"
  669.  
  670. AC_MSG_CHECKING(for GCC 2.7 or higher)
  671. cat >conftest.c << EOF
  672. int main()
  673. {
  674. #if defined(__GNUC__) && defined(__GNUC_MINOR__)
  675. #if __GNUC__ > 2 || __GNUC_MINOR__ > 6
  676. printf("GNU\n");
  677. #endif
  678. #endif
  679. return 0;
  680. }
  681. EOF
  682.  
  683. $CC conftest.c -c -o conftest.o
  684. $CC conftest.o -o conftest
  685. ./conftest >conftest.file
  686. if grep GNU conftest.file >/dev/null; then
  687.   AC_MSG_RESULT(yes)
  688.   HAVEGCC27=yes
  689. else
  690.   AC_MSG_RESULT(no)
  691.   if [[ "x$CC" = "xgcc" ]]; then
  692.     echo "I suggest you upgrade to at least version 2.7 of GCC"
  693.   else
  694.     echo "Couldn't find GCC. UAE may or may not compile and run correctly."
  695.     NR_WARNINGS=`expr $NR_WARNINGS + 1`
  696.   fi
  697. fi
  698.  
  699. AC_MSG_CHECKING(for glibc-2.0 or higher)
  700. if [[ "x$ac_cv_header_features_h" = "xyes" ]]; then
  701.   cat >conftest.c << EOF
  702. #include <features.h>
  703. int main()
  704. {
  705. #if defined(__GLIBC__)
  706. #if __GLIBC__ >= 2
  707. printf("GNU\n");
  708. #endif
  709. #endif
  710. return 0;
  711. }
  712. EOF
  713.  
  714.   $CC conftest.c -c -o conftest.o
  715.   $CC conftest.o -o conftest
  716.   ./conftest >conftest.file
  717.   if grep GNU conftest.file >/dev/null; then
  718.     HAVEGLIBC2=yes
  719.     AC_MSG_RESULT(yes)
  720.   else
  721.     AC_MSG_RESULT(no)
  722.   fi
  723. else
  724.   AC_MSG_RESULT(no)
  725. fi
  726.  
  727. if [[ "x$CC" = "xgcc" ]]; then
  728.   WARNING_CFLAGS="-Wall -Wno-unused -Wno-format -W -Wmissing-prototypes -Wstrict-prototypes"
  729.   OPTIMIZE_CFLAGS="-O3 -fomit-frame-pointer"
  730.   dnl Not nice, but needed to turn off -g
  731.   CFLAGS=
  732. fi
  733.  
  734. if [[ "x$DO_PROFILING" = "xyes" ]]; then
  735.   if [[ "x$CC" = "xgcc" ]]; then
  736.     OPTIMIZE_CFLAGS="-O"
  737.     DEBUG_CFLAGS="-g -fno-inline -fno-omit-frame-pointer -pg -DUSE_PROFILING"
  738.     LDFLAGS="-pg"
  739.   else
  740.     DO_PROFILING=no
  741.     echo "Don't know how to set up profiling for your compiler."
  742.     NR_ERRORS=`expr $NR_ERRORS + 1`
  743.   fi
  744. fi
  745.  
  746. dnl ????What????
  747. if [[ "x$TARGET" = "xggi" ]]; then
  748.   OPTIMIZE_CFLAGS=
  749. fi
  750.  
  751. CFLAGS="$OPTIMIZE_CFLAGS $DEBUG_CFLAGS $WARNING_CFLAGS $CFLAGS $ADDITIONAL_CFLAGS"
  752.  
  753. if [[ "x$HAVEGCC27" = "xyes" ]]; then
  754.   CFLAGS="$CFLAGS -DGCCCONSTFUNC=\"__attribute__((const))\""
  755. else
  756.   CFLAGS="$CFLAGS -DGCCCONSTFUNC="
  757. fi
  758.  
  759. cat >conftest.c << EOF
  760. int main()
  761. {
  762. #ifdef __i386__
  763. printf("386\n");
  764. #elif defined(__mc68000__)
  765. printf("68k\n");
  766. #endif
  767. return 0;
  768. }
  769. EOF
  770.  
  771. $CC conftest.c -c -o conftest.o
  772. $CC conftest.o -o conftest
  773. ./conftest >conftest.file
  774. if grep 386 conftest.file >/dev/null; then
  775.   HAVEI386=yes
  776.   echo "You seem to be using a x86 CPU (UAE will require a 486 to run)"
  777. else if grep 68k conftest.file >/dev/null; then
  778.   HAVE68K=yes
  779.   echo "You seem to be using a 68k CPU."
  780. else
  781.   echo "No special hacks for your CPU, sorry."
  782. fi; fi
  783.  
  784. rm -f conftest*
  785.  
  786. if MACHINE=`uname -a 2>/dev/null`; then
  787.   case "$MACHINE" in
  788.   Linux*)
  789.     HAVELINUX=yes
  790.     ;;
  791.   esac
  792. fi
  793.  
  794. dnl X86.S needs to know whether it needs to add underscores to symbols.
  795. dnl This might break some obscure systems which don't have ELF but don't
  796. dnl add underscores either.
  797.  
  798. AC_MSG_CHECKING(whether we are on an ELF system)
  799.  
  800. if [[ "x$SYSTEM_IS_ELF" = "xdunno" ]]; then
  801.   cat >conftest.c << EOF
  802. int main() { return 0; }
  803. EOF
  804.  
  805.   gcc conftest.c -o conftest
  806.   if [[ "x$FILEPRG" = "xnot-found" ]]; then
  807.     cp conftest conftest.file
  808.   else
  809.     $FILEPRG conftest >conftest.file
  810.   fi
  811.   if grep ELF conftest.file >/dev/null; then
  812.     HAVEELF=yes
  813.     AC_MSG_RESULT(yes)
  814.   else
  815.     AC_MSG_RESULT(no)
  816.   fi
  817. else
  818.   AC_MSG_RESULT(overriden: $SYSTEM_IS_ELF)
  819.   HAVEELF=$SYSTEM_IS_ELF
  820. fi
  821.  
  822. rm -f conftest*
  823.  
  824. AC_ARG_ENABLE(threads,[  --enable-threads        Enable filesystem thread support],[USE_THREADS=$enableval],[])
  825. AC_ARG_ENABLE(penguins,[  --enable-penguins       Enable threads that only make sense on SMP machines],[USE_PENGUINS=$enableval],[])
  826.  
  827. if [[ "x$NEED_THREAD_SUPPORT" = "xyes" ]]; then
  828.   if [[ "x$USE_THREADS" != "xyes" -a "x$USE_PENGUINS" != "xyes" ]]; then
  829.     echo "The gtk+ GUI needs threads; enabling thread support."
  830.   fi
  831. fi
  832.  
  833. if [[ "x$USE_THREADS" = "xyes" -o "x$USE_PENGUINS" = "xyes" -o "x$NEED_THREAD_SUPPORT" = "xyes" ]]; then
  834.   if [[ "x$HAVE_PTHREAD_LIB" = "xyes" ]]; then
  835.     THREADDEP=td-posix
  836.     CFLAGS="$CFLAGS -DSUPPORT_THREADS -D_REENTRANT"
  837.     LIBS="$LIBS -lpthread"
  838.     if [[ "x$HAVE_POSIX4_LIB" = "xyes" ]]; then
  839.       LIBS="$LIBS -lposix4"
  840.     fi
  841.  
  842.     if [[ "x$USE_THREADS" = "xyes" ]]; then    
  843.       CFLAGS="$CFLAGS -DUAE_FILESYS_THREADS"
  844.     fi
  845.     if [[ "x$USE_PENGUINS" = "xyes" ]]; then
  846.       CFLAGS="$CFLAGS -DSUPPORT_PENGUINS"
  847.     fi
  848.  
  849.     if [[ "x$HAVELINUX" = "xno" -o "x$HAVEGLIBC2" = "xno" ]]; then
  850.       echo "Thread support has only been tested on Linux systems with glibc-2.0"
  851.       NR_WARNINGS=`expr $NR_WARNINGS + 1`
  852.     fi
  853.     if [[ "x$TARGET" = "xsvgalib" ]]; then
  854.       echo "If you didn't compile a fixed version of SVGAlib then thread support"
  855.       echo "in UAE will lock your machine real hard."
  856.       NR_WARNINGS=`expr $NR_WARNINGS + 1`
  857.     fi
  858.   else
  859.     echo "You tried to enable threads, but I couldn't find a thread library!"
  860.     NR_ERRORS=`expr $NR_ERRORS + 1`
  861.   fi
  862. fi
  863.  
  864. dnl See if we have something better than GCC 2.7.
  865.  
  866. if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEI386" = "xyes" ]]; then
  867.   SAVECFLAGS=$CFLAGS
  868.   CFLAGS="$CFLAGS -mno-schedule-prologue"
  869.   AC_TRY_COMPILE(,int main(){return 0;}, NO_SCHED_CFLAGS="-mno-schedule-prologue")
  870.   CFLAGS=$SAVECFLAGS
  871. fi
  872.  
  873. dnl If GCC supports exceptions, we don't want them.
  874.  
  875. if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEI386" = "xyes" ]]; then
  876.   SAVECFLAGS=$CFLAGS
  877.   CFLAGS="$CFLAGS -fno-exceptions"
  878.   NOEXCEPTIONS=no
  879.   AC_TRY_COMPILE(,int main(){return 0;}, NOEXCEPTIONS=yes)
  880.   if [[ "x$NOEXCEPTIONS" = "xno" ]]; then
  881.     CFLAGS=$SAVECFLAGS
  882.   fi
  883. fi
  884.  
  885.  
  886. dnl Set up the link to the appropriate machdep directory and select something
  887. dnl for the REGPARAM define.
  888.  
  889. if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEI386" = "xyes" -a "x$DO_PROFILING" = "xno" ]]; then
  890.   MACHDEP=md-i386-gcc
  891.   dnl strength-reduce is turned off not because of paranoia, but because it
  892.   dnl actually makes the code worse in some cases on the i386 (generates too
  893.   dnl many registers, which all end up on the stack).
  894.   CFLAGS="$CFLAGS -DX86_ASSEMBLY -fno-strength-reduce -DREGPARAM=\"__attribute__((regparm(3)))\""
  895.   ASMOBJS=$MACHDEP/X86.o
  896.   CPUOBJS="cpu_f0.o cpu_f1.o cpu_f2.o cpu_f3.o cpu_f4.o cpu_f5.o cpu_f6.o cpu_f7.o cpu_f8.o cpu_f9.o cpu_fA.o cpu_fB.o cpu_fC.o cpu_fD.o cpu_fE.o cpu_fF.o"
  897. else if [[ "x$TARGET" = "xp_os" ]]; then
  898.   CPU=`uname -m`
  899.   if [[ "x$CPU" = "xm68k" ]]; then
  900.      MACHDEP=md-68k
  901.      CFLAGS="$CFLAGS -DREGPARAM=\"__attribute__((regparm(4)))\" -DM68K_FLAG_OPT=1"
  902.   else if [[ "x$CPU" = "xppc" ]]; then
  903.      MACHDEP=md-ppc
  904.      CFLAGS="$CFLAGS -DREGPARAM="
  905.   else if [[ "x$CPU" = "xi386" ]]; then
  906.      MACHDEP=md-i386-gcc
  907.      CFLAGS="$CFLAGS -DX86_ASSEMBLY -fno-strength-reduce -DREGPARAM=\"__attribute__((regparm(3)))\""
  908.   else
  909.      echo "Unsupported CPU: $CPU!"
  910.      exit 5
  911.   fi  
  912.   fi
  913.   fi
  914.   CFLAGS="$CFLAGS -nostdinc -I/gg/include -I/p/../inc -D__POS__"
  915.   OSDEP=od-pos
  916.   CPUOBJS="cpu_f0.o cpu_f1.o cpu_f2.o cpu_f3.o cpu_f4.o cpu_f5.o cpu_f6.o cpu_f7.o cpu_f8.o cpu_f9.o cpu_fA.o cpu_fB.o cpu_fC.o cpu_fD.o cpu_fE.o cpu_fF.o"
  917. else if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVE68K" = "xyes" -a "x$TARGET" = "xamigaos" ]]; then
  918.   MACHDEP=md-68k
  919.   OSDEP=od-amiga
  920.   CFLAGS="$CFLAGS -DREGPARAM=\"__attribute__((regparm(4)))\" -DM68K_FLAG_OPT=1"
  921.   CPUOBJS="cpu_f0.o cpu_f1.o cpu_f2.o cpu_f3.o cpu_f4.o cpu_f5.o cpu_f6.o cpu_f7.o cpu_f8.o cpu_f9.o cpu_fA.o cpu_fB.o cpu_fC.o cpu_fD.o cpu_fE.o cpu_fF.o"
  922. else if [[ "x$TARGET" = "xamigaos" ]]; then 
  923.   dnl: sam: amigaos without gcc 
  924.   MACHDEP=md-generic
  925.   OSDEP=od-amiga
  926.   CFLAGS="$CFLAGS -DREGPARAM="
  927. else if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVE68K" = "xyes" -a "x$DO_PROFILING" = "xno" ]]; then
  928.   dnl sam: This is for linux 68k (REGPARAM is not used under linux)
  929.   MACHDEP=md-68k
  930.   CFLAGS="$CFLAGS -DM68K_FLAG_OPT=1 -DREGPARAM="
  931.   CPUOBJS="cpu_f0.o cpu_f1.o cpu_f2.o cpu_f3.o cpu_f4.o cpu_f5.o cpu_f6.o cpu_f7.o cpu_f8.o cpu_f9.o cpu_fA.o cpu_fB.o cpu_fC.o cpu_fD.o cpu_fE.o cpu_fF.o"
  932. else if [[ "x$TARGET" = "xbeos" ]]; then
  933.   MACHDEP=md-ppc
  934.   CFLAGS="$CFLAGS -DREGPARAM="
  935.   OSDEP=od-beos
  936. else
  937.   CFLAGS="$CFLAGS -DREGPARAM="
  938. fi
  939. fi
  940. fi
  941. fi
  942. fi
  943. fi
  944.  
  945. if [[ "x$HAVELINUX" = "xyes" ]]; then
  946.   OSDEP=od-linux
  947.   if [[ "x$HAVEGLIBC2" = "xyes" -a "x$HAVEI386" = "xyes" ]]; then
  948.     CFLAGS="$CFLAGS -DHAVE_GLIBC_2_LINUX"
  949.   fi
  950. fi
  951.  
  952. if [[ "x$TARGET" = "xx11" -o "x$TARGET" = "xsvgalib" -o "x$TARGET" = "xamigaos" \
  953.      -o "x$TARGET" = "xbeos" -o "x$TARGET" = "xasciiart" -o "x$TARGET" = "xggi" -o "x$TARGET" = "xp_os" ]]; then
  954.   dnl On Unix, BeOS and AmigaOS system, zfile is supposed to work. Dunno about others.
  955.   CFLAGS="$CFLAGS -DUSE_ZFILE"
  956. fi
  957.  
  958. HAVE_USS_SOUND=no
  959. if [[ "x$ac_cv_header_sys_soundcard_h" = "xyes" -o "x$ac_cv_header_machine_soundcard_h" = "xyes" ]]; then
  960.   dnl Avoid surprises
  961.   AC_MSG_CHECKING(whether sys/soundcard.h or machine/soundcard.h works)
  962.   AC_TRY_COMPILE([
  963. #include "confdefs.h"
  964. #ifdef HAVE_SYS_SOUNDCARD_H
  965. #include <sys/soundcard.h>
  966. #else
  967. #include <machine/soundcard.h>
  968. #endif
  969. #include <sys/ioctl.h>
  970. ],
  971. [int soundfd; ioctl (soundfd, SNDCTL_DSP_GETFMTS, 0);],
  972. AC_MSG_RESULT(yes)
  973. HAVE_USS_SOUND=yes,
  974. AC_MSG_RESULT(no))
  975. fi
  976.  
  977. AC_MSG_CHECKING(which sound system to use)
  978. AC_ARG_ENABLE(sound,[  --enable-sound          Enable sound support],[USE_SOUND=$enableval],[])
  979. AC_ARG_ENABLE(file-sound,[  --enable-file-sound          Enable sound output to file],[USE_FILE_SOUND=$enableval],[])
  980.  
  981. if [[ "x$USE_FILE_SOUND" = "xyes" ]]; then
  982.   USE_SOUND=yes
  983. fi
  984.  
  985. if [[ "x$USE_SOUND" = "xno" ]]; then
  986.   AC_MSG_RESULT(sound not enabled)
  987. else
  988.   if [[ "x$USE_FILE_SOUND" = "xyes" ]]; then
  989.     AC_MSG_RESULT(file output)
  990.     SOUNDDEP=sd-file
  991.     USE_SOUND=yes  
  992.   else if [[ "x$HAVE_USS_SOUND" = "xyes" ]]; then
  993.     AC_MSG_RESULT(USS)
  994.     SOUNDDEP=sd-uss
  995.     USE_SOUND=yes
  996.   else if [[ "x$ac_cv_header_sys_audioio_h" = "xyes" -o "x$ac_cv_header_sun_audioio_h" = "xyes" ]]; then
  997.     AC_MSG_RESULT(Solaris)
  998.     SOUNDDEP=sd-solaris
  999.     USE_SOUND=yes
  1000.   else if [[ "x$HAVE_AF_LIB" = "xyes" ]]; then
  1001.     AC_MSG_RESULT(AF sound)
  1002.     SOUNDDEP=sd-af
  1003.     USE_SOUND=yes
  1004.   else if [[ "x$TARGET" = "xp_os" ]]; then
  1005.     AC_MSG_RESULT(pAudio.device)
  1006.     SOUNDDEP=od-pos
  1007.     USE_SOUND=yes
  1008.   else if [[ "x$TARGET" = "xamigaos" ]]; then
  1009.     AC_MSG_RESULT(Amiga audio.device)
  1010.     SOUNDDEP=od-amiga
  1011.     USE_SOUND=yes
  1012.   else if [[ "x$TARGET" = "xbeos" ]]; then
  1013.     AC_MSG_RESULT(BeOS sound)
  1014.     SOUNDDEP=od-beos
  1015.     USE_SOUND=yes
  1016.   else
  1017.     echo "no known sound system found"
  1018.     NR_ERRORS=`expr $NR_ERRORS + 1`
  1019.   fi
  1020.   fi
  1021.   fi
  1022.   fi
  1023.   fi
  1024.   fi
  1025.   fi
  1026. fi
  1027.  
  1028. rm -f src/machdep
  1029. rm -f src/osdep
  1030. rm -f src/threaddep
  1031. rm -f src/sounddep
  1032. rm -f src/target.h
  1033.  
  1034. ln -s $MACHDEP src/machdep
  1035. ln -s $OSDEP src/osdep
  1036. ln -s $THREADDEP src/threaddep
  1037. ln -s $SOUNDDEP src/sounddep
  1038. ln -s targets/$TARGETDEP src/target.h
  1039.  
  1040. if [[ "x$TARGET" = "xamigaos" -o "x$TARGET" = "xp_os" ]]; then
  1041.   dnl Determine the cpu-type
  1042.   AC_MSG_CHECKING(which CPU to use)
  1043.   cpu=`cpu | cut -d' ' -f2`
  1044.   AC_MSG_RESULT($cpu)
  1045.   CFLAGS="$CFLAGS -m$cpu"
  1046.  
  1047.   dnl Is that correct for the fpu ?
  1048.   AC_MSG_CHECKING(which FPU to use)
  1049.   fpu=`cpu | cut -d' ' -f3 | grep '^6888[12]$'`
  1050.   if [[ "x$fpu" != "x" ]]; then
  1051.     dnl gcc only knows about 68881
  1052.     AC_MSG_RESULT(68881)
  1053.     CFLAGS="$CFLAGS -m68881"
  1054.   else
  1055.     AC_MSG_RESULT(none)
  1056.   fi
  1057. fi
  1058.  
  1059. AC_SUBST(ac_cv_c_inline)
  1060. AC_SUBST(NO_SCHED_CFLAGS)
  1061. AC_SUBST(STATFS_NO_ARGS)
  1062. AC_SUBST(BROKEN_JOYSTICK_H)
  1063. AC_SUBST(OLD_JOYSTICK_H)
  1064. AC_SUBST(STATBUF_BAVAIL)
  1065. AC_SUBST(LIBRARIES)
  1066. AC_SUBST(TARGET)
  1067. AC_SUBST(GFXOBJS)
  1068. AC_SUBST(ASMOBJS)
  1069. AC_SUBST(CPUOBJS)
  1070. AC_SUBST(DEBUGOBJS)
  1071. AC_SUBST(SET_MAKE)
  1072. AC_SUBST(MATHLIB)
  1073. if [[ "x$FORMS_HEADER" = "xforms.h" ]]; then
  1074.   FORMS_H_VARIANT=0
  1075. else
  1076.   FORMS_H_VARIANT=1
  1077. fi
  1078. AC_SUBST(FORMS_H_VARIANT)
  1079. AC_SUBST(SHM_SUPPORT_LINKS)
  1080. AC_SUBST(top_srcdir)
  1081.  
  1082. AC_OUTPUT(src/Makefile Makefile)
  1083. if [[ "x$DO_PROFILING" = "xyes" ]]; then
  1084.   echo "Building a profiling version of UAE (select this option only if you know"
  1085.   echo "what you are doing)"
  1086. fi
  1087.  
  1088. echo
  1089. echo
  1090. if [[ "x$NR_ERRORS" = "x0" ]]; then
  1091.   if [[ "x$NR_WARNINGS" = "x0" ]]; then
  1092.     echo "Configuration was successful!"
  1093.   else
  1094.     echo "There were $NR_WARNINGS warnings. That is usually harmless, but read the output"
  1095.     echo "from configure carefully if you run into problems."
  1096.   fi
  1097. else
  1098.   echo "There were $NR_ERRORS errors. UAE may still build and run cleanly, but you may"
  1099.   echo "not get all the features you asked for."
  1100. fi
  1101. echo
  1102.